cbuffer cbPerFrame
{
	float4x4 gLightWVP;
};

Texture2D gDiffuseMap;

SamplerState gTriLinearSam
{
	Filter = MIN_MAG_MIP_LINEAR;
	AddressU = WRAP;
	AddressV = Wrap;
};

struct VS_IN
{
	float3 pos : POSITION;
	float3 norm : NORMAL;
	float2 tex : TEXCOORD;
};

struct VS_OUT
{
	float4 posH : SV_POSITION;
	float2 texC : TEXCOORD;
};

VS_OUT VS(VS_IN vIn)
{
	VS_OUT vOut;
	
	vOut.posH = mul(float4(vIn.pos, 1.0f), gLightWVP);
	
	vOut.texC = vIn.tex;
	
	return vOut;
}

void PS(VS_OUT pIn)
{
	float4 diffuse = gDiffuseMap.Sample( gTriLinearSam, pIn.texC);
	
	clip(diffuse.a - 0.15f);
}
RasterizerState DisableCulling
{
    CullMode = NONE;
};

RasterizerState EnableCulling
{
    CullMode = none;
    //FillMode = Wireframe;
    FrontCounterClockwise = true;
};

DepthStencilState DepthEnabling
{
	DepthEnable = true;
};

BlendState DisableBlend
{
	BlendEnable[0] = FALSE;
};
technique10 ShadowMap
{
	pass P0
	{
		SetVertexShader( CompileShader( vs_4_0, VS() ) );
		SetGeometryShader( NULL );
		SetPixelShader( CompileShader( ps_4_0, PS() ) );
		
		 SetRasterizerState(DisableCulling);       
		//SetDepthStencilState(DepthEnabling, 0);
		//SetBlendState(DisableBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF);
	}
}